const crypto = require("crypto");

function p(e, r) {
    const hmac = crypto.createHmac("sha384WithRSAEncryption", Buffer.from(r, 'utf-8'));
    const signed = hmac.update(Buffer.from(e, 'utf-8')).digest("hex");
    console.log(signed)
    return signed
}

const t = function (e) {
    e.length <= 0 && (e = "quote");
    const t = p(e, "quote_web");
    return t.toString().slice(0, 10).toString().slice(0, 10)
};

// 4ef46c8227669127750045cc2cc6985413a528725a9bad28cd122de4ff058bca8a3360aaa8df18f9728bb6ace828e0fb3b93d258050e0ad36546d1ca54e0603c
//'98d6ea4830'
console.log(t('{"stockId":"82673841481793","_":"1724079854602"}'))

function getToken(stockId, time) {
    return t(JSON.stringify({
        stockId: stockId,
        _: time
    }))
}